<%--
  Created by IntelliJ IDEA.
  User: 86178
  Date: 2021-11-22
  Time: 19:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String basePath = request.getScheme() + "://" + request.getServerName()
            +":"+request.getServerPort()+request.getContextPath()+"/";
%>
<html>
<head>
    <title>浏览学生</title>
    <base href="<%=basePath%>"/>
    <script type="text/javascript" src="js/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        $(function (){

            getStudentInfo();

            $("#doAjax").click(function (){
                getstudentinfo();
            })

        })

        function getStudentInfo(){
            $.ajax({
                url:"student/queryStudent.do",
                datatype:"json",
                success:function(resp){
                    $("#stuinfo").empty();

                    //把添加的信息遍历出来
                    $.each(resp,function(i,n){
                        $("#stuinfo").append(
                            "<tr>" +
                            "<td>"+n.id+"</td>" +
                            "<td>" +n.name+"</td>" +
                            "<td>" +n.age+"</td>" +
                            "</tr>");
                    })

                }
            })
        }

    </script>



</head>
<body>

</body>
</html>
